package org.nepu.scr.indexrate.converter.longevityrate;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.longevityrate.RunningC31;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class RunningC31Converter implements AttributeConverter<RunningC31, String> {

    @Override
    public String convertToDatabaseColumn(RunningC31 runningC31) {
        return JSONUtil.toJsonStr(runningC31);
    }

    @Override
    public RunningC31 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, RunningC31.class);
    }
}
